Towards an ML-Style Polymorphic Type System for C
نویسندگان
چکیده
Advanced polymorphic type systems have come to play an important role in the world of functional programming. But, curiously, these type systems have so far had little impact upon widely-used imperative programming languages like C and C++. We show that ML-style polymorphism can be integrated smoothly into a dialect of C, which we call Polymorphic C. It has the same pointer operations as C, including the address-of operator &, the dereferencing operator , and pointer arithmetic. Our type system allows these operations in their full generality , so that programmers need not give up the exibility of C to gain the beneets of ML-style polymorphism. We prove a type soundness theorem that gives a rigorous and useful characterization of well-typed Polymorphic C programs in terms of what can go wrong when they are evaluated.
منابع مشابه
Operational Interpretations of an Extension of F ω with Control Operators †
We study the operational semantics of an extension of Girard’s System Fω with two control operators: an abort operation that abandons the current control context, and a callcc operation that captures the current control context. Two classes of operational semantics are considered, each with a call-by-value and a call-by-name variant, differing in their treatment of polymorphic abstraction and i...
متن کاملAn Unboxed Operational Semantics for ML Polymorphism
We present an unboxed operational semantics for an ML-style polymorphic language. Different from the conventional formalisms, the proposed semantics accounts for actual representations of run-time objects of various types, and supports a refined notion of polymorphism that allows polymorphic functions to be applied directly to values of various different representations. In particular, polymorp...
متن کاملSemantics for Communication Primitives in a Polymorphic Language
We propose a method to extend an ML-style polymorphic language with transparent communication primitives, and give their precise operational semantics. These primitives allow any polymorphic programs de nable in ML to be used remotely in a manner completely transparent to the programmer. Furthermore, communicating programs may be based on di erent architecture and use di erent data representati...
متن کاملA Functional Abstraction of Typed Contexts
This report investigates abstracting control with functions. This is achieved by defining continuations as functions abstracting lexically a delimited context [C[ ]] rather than dynamically an unlimited one C[ ], as it is usually the case. Because their co-domain is distinguished from the final domain of Answers, such continuations can be composed, and this contrasts with the simple exceptions ...
متن کاملSyntactic Type Polymorphism for Recursive Function De nitions
Higher-order programming languages, such as ML, permit a exible programming style by using compile-time type inference together with the concept of type polymorphism, which allows to specify the types of generic functions. In ML, however, recursive functions must always be given a unique (monomorphic) type inside their deenition. Giving polymorphic types to recursive functions is known as the p...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1996